﻿using System;
using System.Globalization;
using System.Windows.Data;
using MediaAssistant.DAL;

namespace MediaAssistant.Converters
{
    public class SizeBytesLengthToTextConverter:IValueConverter
    {
        #region Implementation of IValueConverter

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                return Utility.GetFileSize(System.Convert.ToUInt32(value));
            }
            catch (Exception)
            {
            }
            return string.Empty;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
